package com.ecut.xzh.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * @author XZH
 */
@Mapper
public interface HabitsMapper {

    /**
     *  查询habits表中是否有这个用户的外键
     * @param userId
     * @return
     */
     @Select("select count(id) from habits where student_id = #{userId}")
    int countByUserId(Long userId);

    /**
     *  新增用户对应的习惯表中的student_id
     * @param userId
     */
    @Insert("insert into habits (student_id) values (#{userId})")
    void insert(Long userId);
}
